home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ahoy 1986 April
/
Ahoy_Magazine_86-04_1986_Double_L.d64
/
mr. mysto v2.0
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
4KB
|
129 lines
10 gosub830
20 dimq$(500),yn$(500)
30 b$=" "
40 d$=""
50 s$=""
60 db$=d$+b$+b$+b$+b$+d$
70 yn$(0)="y":q$(0)="nothing":q$=q$(0)
80 rem mr. mysto 1-16-85 : c-64 version 2.0
90 print"[147]"," mr. mysto",," by frank dinunzio 1/16/1985"
100 print:print"an experiment in artificial intelligence"
110 print,"s-start a new category",,"g-get an existing one "
120 geta$:ifa$<>"s"anda$<>"g"then120
130 input"which category";o$
140 ifa$="g"thengosub770
150 gosub520:printdb$"do you want me to speak?":gosub1140:tk$=a$
160 printdb$" pick a word and i will try",,"to deduce","what it is."
170 fori=0to3000:next:gosub650
180 r=0:gu$=yn$(0):ta$=yn$(0)
190 iflen(yn$(r))=len(ta$)then ifyn$(r)=ta$thenrr=r:gosub1110:gosub650:goto220
200 ifr<nthenr=r+1:goto190
210 goto230
220 gosub1140: ta$=ta$+a$:goto190
230 ifa$="y"thenprintdb$"i am right again!":gosub650:fort=1to999:next:goto410
240 printdb$"i am sorry but i do not know the answer,please tell me what it is."
250 s=1:gosub650
260 input"";aa$:iflen(aa$)<18then280
270 printdb$"answer must be less than 18 letters.":fori=0to999:next:goto240
280 ts$=q$(rr):tl=len(ts$)
290 printdb$"type a question that will help me tell",
300 printaa$" from "ts$
310 gosub650:input"";qq$
320 ifright$(qq$,1)<>"?"thenqq$=qq$+"?"
330 printdb$"enter the answer for ",,aa$;" (y/n)":gosub650
340 gosub1140:n=n+1:p$=left$(ta$,len(ta$)-1)
350 ts$=q$(rr):q$(rr)=qq$
360 x$="n":z$="y"
370 ifa$="n"thenx$="y":z$="n"
380 yn$(n)=p$+x$:q$(n)=ts$:n=n+1
390 yn$(n)=p$+z$:q$(n)= aa$
400 bu=bu+1:ifbu>10thenbu=0:gosub1160
410 printdb$"try another?":gosub650:print""
420 geta$
430 ifa$="n"ands=1thengosub480:end
440 ifa$="n"thenend
450 ifa$="y"then160
460 ifpeek(197)=4then1020
470 goto420
480 rem ******save to disk******
490 printdb$"saving "o$
500 open1,8,2,"@0:"+o$+",s,w":print#1,n
510 forw=0ton:print#1,yn$(w):print#1,q$(w):next:close1:return
520 rem ******draw face******
530 print"[147]"s$"[175][175][175][175][175][175][175][175][175][175][175][175][175][175][175]"
540 forf=1to6:prints$"[180]"s$"[167]":next
550 prints$"[157][157][157][183][183][183][207][183][183][183][183][183][183][183][183][183][183][183][183][183][208][183][183][183]"
560 forf=1to6:prints$"[165]"s$"[167]":next
570 prints$"[205] [206]"
580 prints$" [205] [206]"
590 prints$" [205] [206]"
600 prints$" [205] [206]"
610 prints$" [183][183][183][183][183][183][183]"
620 prints$""s$"mr. mysto"
630 prints$"oo"
640 prints$"[209]"
650 printd$+s$"[145][145][145][145][145]";:iftk$="n"thenprint:return
660 s=54272:fore=stos+28:pokee,0:next
670 forl=1to10: print"[157][157][157][157][157][183][183][183][183][183]";:print"[157][157][157][157][157][205][175][175][175][206]";
680 forj=1to50:next
690 print"[157][157][157][157][157][183][183][183][183][183]";
700 rem ******sound******
710 poke54296, 10 :poke54277, 85 :poke54278, 245
720 p=int(rnd(0)*5)
730 fori=0top :rem inflection
740 rn=int(rnd(0)*6):rem pitch
750 poke 54276, 33 :poke 54273,rn+i
760 next i:next:pokes+24,0:print:return
770 rem ******load routine******
780 open1,8,2,o$+",s,r"
790 open15,8,15:input#15,a$:ifa$<>"00"thenclose15:close1:goto820
800 print"loading "o$:input#1,n
810 forw=0ton:input#1,yn$(w),q$(w):next:close1:return
820 print"sorry-can't find "o$" on this disk":fori=1to3000:next:run
830 print"[147] mr. mysto
840 [153]"a study in semi-artificial intelligence"
850 [153]" think of a word and i will try to guess what it is ";
860 [153]"by process of logic.
870 print" you will be asked some clue questionsthat must be answered ";
880 print"in order for me toguess the word. if i don't get it right the first";
890 print" time, i will ask you one more question and then i guarantee that you
900 [153]"won't fool me on that word any more.
910 print" to begin you are asked to choose if you want to use previously";
920 print" stored data from disk or to start a new set of data.i suggest";
930 print" that a seperate formatted diskbe used for the data files.
940 [153]" as the program runs it becomes wiser with each question asked.";
950 [153]" when you are finished with the program just type 'n'";
960 [153]" when asked 'another' and the compiled knowledge ";
970 [153]"will be saved to disk for future use.
980 print"remember - i am no smarter than the userwho gives me information.
990 [153],," <hit any key>";
1000 [161]a$:[139]a$[178]""[167]1000
1010 [142]
1020 [143] ******edit routine******
1030 [153]"load","c=change - n=next"
1040 [129]zz[178]0[164]n:[153]zz;q$(zz),"(c/n)"
1050 [161]a$:[139]a$[179][177]"c"[175]a$[179][177]"n"[167]1050
1060 [139]a$[178]"n"[167]1090
1070 [153]"change "q$(zz)
1080 [133]"to ";q$(zz)
1090 [139]zz[178]n[167]:[153]"load":[141]480:[138]20
1100 [130]
1110 [143] ******is it a quess*****
1120 [153]db$;:[139][201](q$(r),1)[178]"?"[167][153]q$(r):[142]
1130 [153]"is your word "q$(r)"?":[142]
1140 [161]a$:[139]a$[179][177]"y"[175]a$[179][177]"n"[167]1140
1150 [142]
1160 [143] ******sort routine******
1170 s[178]n:[153]db$"sorting"
1180 s[178][181](s[173]2)
1190 [139]s[177][178]1[167]1220
1200 fr[178][184](0)[171]([180]([184](0))[179]0)[172]65535:[139]fr[177]1200[167][142]
1210 [153]"memory low - start a new file":[141]480:[128]
1220 [129]k[178]0[164]s:[129]i[178]k[164]n[171]s[169]s
1230 j[178]i:t$[178]yn$(i[170]s):tt$[178]q$(i[170]s)
1240 [139][195](t$)[177][178][195](yn$(j))[167]1270
1250 yn$(j[170]s)[178]yn$(j):q$(j[170]s)[178]q$(j)
1260 j[178]j[171]s:[139]j[177]1[167]1240
1270 yn$(j[170]s)[178]t$:q$(j[170]s)[178]tt$
1280 [130]:[130]:[137]1180